﻿Imports MeoTom.Core.BLL
Imports Microsoft.ApplicationBlocks.Data

Namespace DAL
    Public Class UserProvider
        Inherits DataAccess

        Private util As New Utilities.Common()

        Public Sub New()

        End Sub

        Public Sub ResetPassword(ByVal u As Users)
            Try
                Dim param(3) As SqlClient.SqlParameter
                param(0) = New SqlClient.SqlParameter("@Password", SqlDbType.VarChar, 150)
                param(0).Value = u.Password
                param(1) = New SqlClient.SqlParameter("@ID", SqlDbType.Int, 4)
                param(1).Value = u.ID
                param(2) = New SqlClient.SqlParameter("@SiteID", SqlDbType.Int, 4)
                param(2).Value = Configs.SiteID

                SqlHelper.ExecuteNonQuery(strConn, CommandType.StoredProcedure, "Justin_Users_ResetPassword", param)
            Catch ex As Exception
                Throw New Exception(ex.Message)
            End Try
        End Sub

        Public Function Login(ByVal u As Users) As SqlClient.SqlDataReader
            Dim param(3) As SqlClient.SqlParameter
            param(0) = New SqlClient.SqlParameter("@UserName", SqlDbType.NVarChar, 50)
            param(0).Value = u.UserName
            param(1) = New SqlClient.SqlParameter("@Password", SqlDbType.VarChar, 150)
            param(1).Value = u.Password
            param(2) = New SqlClient.SqlParameter("@SiteID", SqlDbType.Int, 4)
            param(2).Value = Configs.SiteID

            Return SqlHelper.ExecuteReader(strConn, CommandType.StoredProcedure, "Justin_Users_UserLogin", param)
        End Function
    End Class
End Namespace